package cn.itcast.clients;

import cn.itcast.config.FeignClientConfiguration;
import cn.itcast.fallback.RoomsClientFallBackFactory;
import cn.itcast.entity.Result;
import cn.itcast.entity.Room;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "room-service",
        configuration = FeignClientConfiguration.class
        , fallbackFactory = RoomsClientFallBackFactory.class
)
public interface RoomClients {
    @PutMapping("/room")
    Result updateRoom(@RequestBody Room room);

    @GetMapping("/room/{roomNo}")
    Result<Integer> findIdByRoomNo(@PathVariable("roomNo") String roomNo);

    @GetMapping("/{id}")
    Result<Room> findById(@PathVariable Long id);

    @PutMapping("/room/updateRoomByNumber")
    Result updateRoomByNumber(@RequestBody Room room);
}
